package com.by.facade.enums.order;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum RefundOrderPlatformEnum {

    WX(RefundOrderPlatformEnum.WX_CODE, "微信"),
    ALI(RefundOrderPlatformEnum.ALI_CODE, "支付宝"),
    ;

    private Integer code;
    private String desc;

    private static final Map<Integer, RefundOrderPlatformEnum> MAP = Arrays.stream(RefundOrderPlatformEnum.values())
            .collect(Collectors.toMap(RefundOrderPlatformEnum::getCode, Function.identity()));


    public static RefundOrderPlatformEnum resolve(Integer code) {
        return MAP.get(code);
    }

    public static final int WX_CODE = 1;
    public static final int ALI_CODE = 2;

}
